home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / cp1.zip / INS1.C < prev    next >
C/C++ Source or Header  |  1993-06-11  |  3KB  |  71 lines

  1. ===========================================================================
  2.  BBS: The Abacus * HST/DS * Potterville MI
  3. Date: 06-06-93 (13:01)             Number: 11
  4. From: SID ROGERS                   Refer#: 137
  5.   To: STEVE KLEMETTI                Recvd: NO  
  6. Subj: Insert                         Conf: (36) C Language
  7. ---------------------------------------------------------------------------
  8. Steve,
  9. Try this.....
  10. #include <conio.h>
  11. #include <stdlib.h>
  12.  
  13. /* The following Shift Macros, hereby donated to the public domain, were
  14.    patterned after a message orignally posted by Ed Kowalski in the
  15.    C_Echo conference */
  16.  
  17. /*** the BIOS shift status byte at 0000:0x417
  18. Bit#  7 6 5 4 3 2 1 0
  19.       x . . . . . . .   insert state     128
  20.       . x . . . . . .   caps lock         64
  21.       . . x . . . . .   num  lock         32
  22.       . . . x . . . .   scroll lock       16
  23.       . . . . x . . .   alt depressed      8
  24.       . . . . . x . .   ctrl depressed     4
  25.       . . . . . . x .   left shift         2
  26.       . . . . . . . x   right shift        1 */
  27.  
  28. /* peekb is a Borland Product(s) function */
  29.  
  30. #define  ShiftState  peekb(0,0x417)
  31. #define InsertState (peekb(0,0x417) & 128)
  32. #define    CapsLock (peekb(0,0x417) &  64)
  33. #define     NumLock (peekb(0,0x417) &  32)
  34.  
  35. #define  ScrollLock (peekb(0,0x417) &  16)
  36. #define    AltPress (peekb(0,0x417) &   8)
  37. #define   CtrlPress (peekb(0,0x417) &   4)
  38. #define   LeftShift (peekb(0,0x417) &   2)
  39. #define  RightShift (peekb(0,0x417) &   1)
  40. main()
  41. {
  42.   int done = 0;
  43.   _setcursortype(_NOCURSOR);   /* Borland Product(s) function */
  44.   clrscr();
  45.   while(!done)
  46.   {
  47.     gotoxy(1,1);
  48.     printf("ShiftState == %3u\n",ShiftState);
  49.     printf("    Insert == %3u\n",InsertState); /*128 == active */
  50.     printf("  CapsLock == %3u\n",CapsLock);
  51.     printf("   NumLock == %3u\n",NumLock);
  52.     printf("ScrollLock == %3u\n",ScrollLock);
  53.     printf("  Altpress == %3u\n",AltPress);
  54.     printf(" CtrlPress == %3u\n",CtrlPress);
  55.     printf(" LeftShift == %3u\n",LeftShift);
  56.     printf("RightShift == %3u\n",RightShift);
  57.     if(RightShift) done = 1;
  58.   }
  59.   _setcursortype(_NORMALCURSOR);  /* Borland Product(s) function */
  60.   return 0;
  61. }
  62.    === Sid ===
  63.  
  64.  
  65. ... OFFLINE 1.39 * From here to nowhere..an eternity
  66. ---
  67.  * Origin: Fire Fly BBS (508)356-2469 Ipswich, MA USA (1:330/173)
  68. SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
  69. SEEN-BY: 153/752 154/40 77 157/110 159/100 125 430 575 950 203/23 209/209
  70. SEEN-BY: 261/1023 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20
  71.